package com.hqyj.fj.javaSpringBoot.modules.test.entity;

import com.hqyj.fj.javaSpringBoot.modules.common.entity.AbstractEntity;

import javax.persistence.*;
import java.util.List;

@Entity
@Table(name="test_shcool")
public class School extends AbstractEntity {
    private String schoolName;

    /*
     * OneToMany：多方使用 joinClumn，创建外键，一方使用 mappedBy 属性
     * cascade：联级操作
     * fetch：加载数据策略
     */
    @OneToMany(mappedBy = "school", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    private List<Clazz> clazzes;

    public String getSchoolName() {
        return schoolName;
    }

    public void setSchoolName(String schoolName) {
        this.schoolName = schoolName;
    }

    public List<Clazz> getClazzes() {
        return clazzes;
    }

    public void setClazzes(List<Clazz> clazzes) {
        this.clazzes = clazzes;
    }
}
